global root "/Volumes/Workgroup/Lab/Lab-heimb/Montenovo/Volunteering Paper/Data"
global results "$root/07_results/RR/main"
global dictionaries "$root/Dictionaries"


cd "$dictionaries"
capture log close
log using preliminary_regressions_fd, replace


cd "$root"

use fd_appended_analytic_010305111719, clear 

//drop if education_head==.


gen whether_donated=0
replace whether_donated=1 if total_giving>0
sum whether_donated

//bysort year: sum taxprice


eststo extensive_margin_fe_fd: reghdfe whether_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural, absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_margin_sm_fd: reghdfe whether_volunteer_person taxprice post_tax_income hourly_wage_aftertax full_time  age black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if (sex==1 & sequence_num==1 & married==0), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_margin_sf_fd: reghdfe whether_volunteer_person taxprice post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if (sex==2 & sequence_num==1 & married==0), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_margin_mm_fd: reghdfe whether_volunteer_person taxprice post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if (sex==1 & married==1), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_margin_mf_fd: reghdfe whether_volunteer_person taxprice post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if (sex==2 & married==1), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


drop if year==2010
drop if hours_volunteer_person==0


eststo intensive_margin_fe_fd: reghdfe hours_volunteer_person taxprice post_tax_income hourly_wage_aftertax full_time  age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural, absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo intensive_margin_sm_fd: reghdfe hours_volunteer_person taxprice post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if (sex==1 & sequence_num==1 & married==0), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo intensive_margin_sf_fd: reghdfe hours_volunteer_person taxprice post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if (sex==2 & sequence_num==1 & married==0), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo intensive_margin_mm_fd: reghdfe hours_volunteer_person taxprice post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if (sex==1 & married==1), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


eststo intensive_margin_mf_fd: reghdfe hours_volunteer_person taxprice  post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if (sex==2 & married==1), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

cd "$results"

	 esttab extensive_margin_fe_fd extensive_margin_sm_fd extensive_margin_sf_fd extensive_margin_mm_fd  extensive_margin_mf_fd using "preliminary_regress_extensive_fd.rtf", se star(* 0.10 ** 0.05 *** 0.01) replace se(a4) b(a3) title("Extensive Margin - Tax Price First Dollar") addnotes("Outcome Variable: Whether head or spouse in the household volunteered" "Demographic variables refer to head of household" "Col 1: Pooled Sample" "Col 2: Single Males" "Col 3: Single Females" "Col 4: Married Males" "Col 5: Married Females") modelwidth(12) label cells(b(star fmt(3)) se(par fmt(3)))
	 
	 esttab intensive_margin_fe_fd intensive_margin_sm_fd intensive_margin_sf_fd intensive_margin_mm_fd intensive_margin_mf_fd using "preliminary_regress_intensive_fd.rtf", se star(* 0.10 ** 0.05 *** 0.01) replace se(a4) b(a3) title("Intensive Margin  - Tax Price First Dollar") addnotes("Outcome Variable: Total hours volunteered by head and spouse" "Demographic variables refer to head of household"  "Col 1: Pooled Sample" "Col 2: Single Males" "Col 3: Single Females" "Col 4: Married Males" "Col 5: Married Females") modelwidth(12) label cells(b(star fmt(3)) se(par fmt(3)))
	 
	 log close
//////////////////////////////////////////////////////////////////////////
